#!/bin/bash

# 配置nginx上传文件的最大值(运行docker后执行)
# echo "client_max_body_size 10G;" > /server/nginx_proxy/conf.d/uploadsize.conf

# 配置ddns的依赖
yum install -y bind-utils libxml2

# 坚果云初始化----------------------------Start

#--挂载坚果云--#
# 先安装EPEL源
yum install -y epel-release
# 再安装davfs2
yum install -y davfs2

mkdir -p /download/jianguoyun

cp /etc/davfs2/davfs2.conf /etc/davfs2/davfs2.conf.bak

# 解决挂载失败的问题，参考:https://zohead.com/archives/davfs2-nutstore/
sed -i 's/# ignore_dav_header 0/ignore_dav_header 1/g' /etc/davfs2/davfs2.conf

# 不需要
# sed -i 's/# use_locks       1/use_locks       0/g' /etc/davfs2/davfs2.conf

# 设置开机自动挂载(不自动挂载)
# 设置用户名及密码
echo "https://dav.jianguoyun.com/dav/backup changetoyouruser changetoyourpasswd" >> /etc/davfs2/secrets
# _netdev:设备需要网络, noauto:开机不自动挂载, user:允许普通用户加载该文件系统
echo "https://dav.jianguoyun.com/dav/backup /download/jianguoyun davfs _netdev,noauto,user 0 0" >> /etc/fstab
# 下面这种挂载方式无效，而且后面再手动挂载后过一会儿就会出现"传输端点尚未连接"的错误。
# echo "mount.davfs  https://dav.jianguoyun.com/dav/backup /download/jianguoyun" >> /etc/rc.local

# 坚果云初始化----------------------------End


# nextcloud初始化----------------------------Start

# 设置solr目录的user及group
mkdir -p /server/nextcloud_solr
chown 8983:8983 /server/nextcloud_solr

# nextcloud初始化----------------------------End

